use GD;

# create a new image
$im = new GD::Image(800,600);

# allocate some colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);       
$red = $im->colorAllocate(255,0,0);      
$blue = $im->colorAllocate(0,0,255);



# Draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);



# make sure we are writing to a binary stream
        $poly = new GD::Polygon;
        $poly->addPt(50,50);
        $poly->addPt(99,99);
		$poly->addPt(29,93);
		$poly->addPt(129,94);
		$poly->addPt(329,64);
        $im->openPolygon($poly,$blue);

$imagename=shift;
open(PNGOUT, ">","gd.test.png");     
binmode PNGOUT;
# Convert the image to PNG and print it on standard output
print PNGOUT $im->png;
close(PNGOUT);
